import { Protected } from '@/layouts/protected'
import RootLayout from '@/layouts/root-layout'
import FaceView from '@/pages/auth/face'
import LoginView from '@/pages/auth/login'
import AuthLayout from '@/pages/auth/layout'
import WorkBenchView from '@/pages/workbench/page'
import {
  createBrowserRouter,
  createRoutesFromElements,
  Navigate,
  Route,
} from 'react-router-dom'

export const router = createBrowserRouter(
  createRoutesFromElements(
    <>
      <Route element={<Protected />}>
        <Route path='/' element={<RootLayout />}>
          <Route path='' element={<Navigate to='workbench' />} />
          <Route path='workbench' element={<WorkBenchView />} />
        </Route>
      </Route>
      <Route element={<AuthLayout />}>
        <Route path='/login' element={<LoginView />} />
        <Route path='/face' element={<FaceView />} />
      </Route>
    </>,
  ),
)
